var gulp = require('gulp'),
    browserSync = require('browser-sync').create(),
    nodemon = require('gulp-nodemon')

var reload = browserSync.reload

gulp.task('server', function(){
    nodemon({
        script: 'server/app.js',
        ignore: ['gulpfile.js', 'node_modules/'],
        env:{
            'NODE_ENV': 'development'
        }
    }).on('start', function(){
        browserSync.init({
            proxy: 'http://localhost:3000',
            files: ["server/views/**", "server/router/**"],
            port: 7000,
            ghostMode: { clicks: true, scroll: true },
            browser: ['chrome']
        }
            ,function(){
                console.log('browser refreshed.')
            }
        )
    })
})

gulp.task('default', ['server'], function(){})